<?php
/**
 * Created by PhpStorm.
 * User: User
 * Date: 2017/11/30
 * Time: 19:19
 */
$dbms = 'mysql';     //数据库类型
$host = '127.0.0.1'; //数据库主机名
$dbName = 'kinfy';    //使用的数据库
$user = 'root';      //数据库连接用户名
$pass = 'root';          //对应的密码
$dsn = "{$dbms}:host={$host};dbname={$dbName}";
$dsn = "mysql:host=127.0.0.1;dbname=kinfy";

try {
    $dbh = new PDO($dsn, $user, $pass); //初始化一个PDO对象
    echo "连接成功<br/>";

    $sql = 'SELECT * FROM `article` WHERE id > ?';

    $sth = $dbh->prepare($sql);
    $sth->setFetchMode(PDO::FETCH_ASSOC);

    $sth->execute([1]);

    $r = $sth->fetchAll();

    print_r($r);


    $dbh = null;
} catch (PDOException $e) {
    die ("Error!: " . $e->getMessage() . "<br/>");
}


$db = new DB();

$db ->table('article');
$db ->where('id','>',1);
$db ->where('title','like','%111%');
$db ->get();

$db ->table('article')
    ->where('id','>',1)
    ->where('title','like','%111%')
    ->get();




